package com.wsm.springcloud_compose.compose_user_produce.controller;

import com.wsm.springcloud_compose.compose_user_bean.response.SysUsersResponse;
import com.wsm.springcloud_compose.compose_user_produce.business.UserBiz;
import com.wsm.springcloud_compose.compose_user_produce.domain.SysPermissions;
import com.wsm.springcloud_compose.compose_user_produce.domain.SysRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @name: AdminController
 * @Author: wangshimin
 * @Date: 2019-09-01  17:14
 * @Description:
 */
@RestController
public class UserController {

    @Value("${server.port}")
    private String port;

    @Autowired
    UserBiz userBiz;


    @RequestMapping(value = "/login", method = RequestMethod.GET)
    public SysUsersResponse login(@RequestParam(value = "userName", required = true) String userName) {
        return userBiz.login(userName);
    }


    @RequestMapping(value = "/getRolesById", method = RequestMethod.GET)
    public List<SysRoles> getRolesById(long id) {
        return userBiz.getRolesById(id);
    }


    @RequestMapping(value = "/getPermissionsById", method = RequestMethod.GET)
    public List<SysPermissions> getPermissionsById(long id) {
        return userBiz.getPermissionsById(id);
    }

}